<template>
  <el-dialog
    title=''
    :visible.sync='visible'
    width='80%'
    :before-close='handleClose'>
    <el-form ref='ruleForm' :model='ruleForm' label-width='130px'>
      <el-row type='flex' align='middle'>
        <el-col :span='12'>退货信息</el-col>
        <el-col :span="12" class="text-right">
          <el-button type="danger" @click="handleRuten">打印退货单</el-button>
        </el-col>
      </el-row>
      <el-divider content-position='center'></el-divider>
      <el-row>
        <el-col :span='6'>
          <el-form-item label='配车合同号:'>
            <span>{{ ruleForm && ruleForm.contractNum }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='采购门店:'>
            <span>{{ ruleForm && ruleForm.storeName }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='车顶颜色:'>
            <span>{{ ruleForm && ruleForm.roofColor }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='车身颜色:'>
            <span>{{ ruleForm && ruleForm.outColor }}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span='6'>
          <el-form-item label='品牌:'>
            <span>{{ ruleForm && ruleForm.brandName }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='车系:'>
            <span>{{ ruleForm && ruleForm.seriesName }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='车型:'>
            <span>{{ ruleForm && ruleForm.modelName }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='内饰颜色:'>
            <span>{{ ruleForm && ruleForm.inColor }}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span='6'>
          <el-form-item label='标准进价:'>
            <span>{{ ruleForm && ruleForm.criterionPrice }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='实际进价:'>
            <span>{{ ruleForm && ruleForm.realityPrice }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='资金来源:'>
            <span>{{ ruleForm && ruleForm.capitalSourceDict }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='资金利息:'>
            <span>{{ ruleForm && ruleForm.zjlxId }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='计息起始日期:'>
            <span>{{ ruleForm && ruleForm.interestStartTime }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='贷款到期日期:'>
            <span>{{ ruleForm && ruleForm.loanEndTime }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='购车方式:'>
            <span>{{ ruleForm && ruleForm.buyCarType }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='排放标准:'>
            <span>{{ ruleForm && ruleForm.emissionStandards }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='发动机号:'>
            <span>{{ ruleForm && ruleForm.engineModel }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='车架号:'>
            <span>{{ ruleForm && ruleForm.vin }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='仓库:'>
            <span>{{ ruleForm && ruleForm.storageName }}</span>
          </el-form-item>
        </el-col>
        <el-col :span='6'>
          <el-form-item label='仓位:'>
            <span>{{ ruleForm && ruleForm.storageSiteName }}</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </el-dialog>
</template>

<script>
import {
  detailById
} from '@/api/pre-sale/newCarStock/purchaseReturn'
import DataTable from '@/components/DataTable'
import { getDict } from '@/utils/index'
export default {
  components: { DataTable },
  props: ['detailData', 'visible'],
   watch:{
    detailData:{
      handler(data){
        let zjly=[]
        let d = data.capitalSourceDictId.split(',')
        getDict(['资金来源'])['资金来源'].map((it) => {
          if (d.includes(it.value.toString())) {
            zjly.push(it.text)
          }
        })
        data.capitalSourceDict = zjly.toString()
    
      }
    }
  },
  data() {
    return {
      ruleForm: {}
    }
  },
  async mounted() {
    if (this.detailData) {
      await detailById(this.detailData.id).then(res => {
        const { success, data } = res
        if (success) {
           let zjly=[]
        let d = data.capitalSourceDictId&&data.capitalSourceDictId.split(',')||[]
        getDict(['资金来源'])['资金来源'].map((it) => {
          if (d.includes(it.value.toString())) {
            zjly.push(it.text)
          }
        })
        data.capitalSourceDict = zjly.toString()
          this.ruleForm = data
        }
      })
    }
  },
  methods: {
    // 打印退货单
    handleRuten() {

    },
    handleClose() {
      this.$emit('set-visible', false)
    },
    handleSizeChange() {

    },
    handleCurrentChange() {

    }
  }
}
</script>

<style scoped>

</style>
